
public class TestStackTrace {
	
	private static void a(String s) {
		b(s);
	}
	
	private static void b(String s) {
		c(s);
	}
	
	private static void c(String s) {
		System.out.println(s.substring(1));
	}

	public static void main(String[] args) {
		try {
			a(null);
			
		} catch (Exception e) {
			StackTraceElement[] stes = e.getStackTrace();
			
			StringBuilder sb = new StringBuilder("ex: ");
			sb.append(e.getClass().getSimpleName());
			sb.append(": ");
			sb.append(e.getMessage());
			sb.append("\r\n");
			
			for(StackTraceElement se : stes) {
				sb.append("\tat:");
				sb.append(se.getClassName());
				sb.append('.');
				sb.append(se.getMethodName());
				sb.append("() ");
				sb.append(se.getLineNumber());
				
				sb.append("\r\n");
			}
			
			System.err.println(sb.toString());
		}
	}
}
